import { request } from '@umijs/max';
export const getBooksApi =(params)=>{
    return request('/api/book',{
        method:"GET",
        params:{
            ...params
        }
    })
}

export const addBookApi = (data)=>{
    return request('/api/book',{
        method:'POST',
        data
    })
}

export const editBookApi = (id,data)=>{
    return request(`/api/book/${id}`,{
        method:'PATCH',
        data
    })
}

// 根据id获取书籍信息
export const getBookByIdApi =(id)=>{
    return request(`/api/book/${id}`)
}

// 修改书籍信息
export const editBookInfoApi = (id,data)=>{
    return request(`/api/book/${id}`,{
        method:"PATCH",
        data,

    })
}
export const deleteBookApi = (id)=>{
    return request(`/api/book/${id}`,{
        method:'DELETE'
    })
}